﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Drawing;
using System.Windows.Forms;

using ThoughtWorks.QRCode.Codec;
using ThoughtWorks.QRCode.Codec.Data;
using ThoughtWorks.QRCode.Codec.Util;

namespace Webcam
{
    class QrTool
    {
        public String Decode()
        {

            String fileName = "qr.jpg";
            //picDecode.Image = new Bitmap(fileName);
            try
            {
                QRCodeDecoder decoder = new QRCodeDecoder();
                
                String decodedString = decoder.decode(new QRCodeBitmapImage(new Bitmap(fileName)));
                return decodedString;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return null;
            }
        }
    }
}
